
<%@page contentType="text/html" pageEncoding="windows-1252"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>JSP Page</title>
    </head>
    <body>
        <c:if test="${empty data}">
            <h1>Data Kosong</h1>
        </c:if>

        <c:if test="${not empty data}">
            <table border="1">
                <thead>
                    <tr>
                        <th>Id</th>
                        <th>Username</th>
                        <th>Password</th>
                        <th>Real Name</th>
                        <th>About</th>
                        <th colspan="2">Operation</th>
                    </tr>
                </thead>
                <tbody>
                    <c:forEach items="${data}" var="author">
                        <tr>
                            <c:url var="show_link" value="/author?do=show&id=${author.id}"/>
                            <td><a href="${show_link}">${author.id}</a></td>

                            <td>${author.username}</td>
                            <td>${author.password}</td>
                            <td>${author.realName}</td>
                            <td>${fn:substring(author.about,0,10)}</td>

                            <c:url var="update_link" value="/author?do=update&id=${author.id}"/>
                            <td><a href="${update_link}">Update</a></td>

                            <c:url var="delete_link" value="/author?do=delete&id=${author.id}"/>
                            <td><a href="${delete_link}">Delete</a></td>
                        </tr>
                    </c:forEach>
                </tbody>
            </table>
        </c:if>
        <c:url var="new_link" value="/author?do=new"/>
        <a href="${new_link}">New</a>
    </body>
</html>
